Mermaid Bay
#devtools::install_github("marine-ecologist/coralseed", lib = "/Users/rof011/coralseed")
#devtools::install("/Users/rof011/coralseed")
library(coralseed)
library(tidyverse)
library(sf)
library(tmap)
library(widgetframe)
seascape <- seascape_probability(reefoutline=reef_map, habitat=benthic_map)
palfrey09 <- "/Users/rof011/Library/CloudStorage/OneDrive-CSIRO/Data - SeaSims/conniemodels/Dispersal_SettlementRate/lizard_del_14_1512_sim1/lizard_del_14_1512_sim1/plots/day_12036/run_day_12036_lizard_del_14_1512_sim1_18.json"
particles <- seed_particles(input=palfrey09, seascape=seascape,
competency.function = "exponential",
limit.time = 720, simulate.mortality = "typeI",
simulate.mortality.n = 0.1, probability="additive",
return.plot=FALSE, silent=TRUE)
settlers <- settle_particles(particles, probability="additive", silent=TRUE)
map output
tmap::tmap_mode(mode = "view")
## tmap mode set to interactive viewing
tmp <- tmap::tmap_options(check.and.fix = TRUE) +
tmap::tm_tiles("Esri.WorldImagery", group = "<b> [Seascape]</b> satellite map", alpha = 0.85) +
tmap::tm_tiles("Esri.WorldTopoMap", group = "<b> [Seascape]</b> base map", alpha = 0.85) +
# seascape habitats
tmap::tm_shape(seascape_probability |> sf::st_make_valid(), name = "<b> [Seascape]</b> habitats") +
tmap::tm_borders(col = "black", lwd = 0.2) +
tmap::tm_fill("class",
name = "Benthic habitats", alpha = 0.6,
palette = c(
"Plateau" = "cornsilk2",
"Back Reef Slope" = "darkcyan",
"Reef Slope" = "darkseagreen4",
"Sheltered Reef Slope" = "darkslategrey",
"Inner Reef Flat" = "darkgoldenrod4",
"Outer Reef Flat" = "darkgoldenrod2",
"Reef Crest" = "coral3")) +
# seascape probability
tmap::tm_shape(seascape_probability |> sf::st_make_valid(), name = "<b> [Seascape]</b> probability") +
tmap::tm_fill("settlement_probability", id = "P settlement", alpha = 0.6) +
tmap::tm_borders(col = "black", lwd = 0.2) +
# particle tracks
tmap::tm_shape(particletracks, name = "<b> [Particles]</b> competency") +
tmap::tm_lines("competency", lwd = 0.8, palette = c("lightblue", "cadetblue4")) +
# #
# # settlement paths
tmap::tm_shape(settler_paths |> sf::st_make_valid(), id="id", name = "<b> [Settlers]</b> pre-settlement tracks") +
tmap::tm_lines(lwd = 0.8, col = "darkgrey") #+
#
# # settlers
# tmap::tm_shape(settle_particles$points, id="dispersaltime", name = "<b> [Settlers]</b> post-settlement location") +
# tmap::tm_dots(col = "aquamarine3") +
#
# # settlement area
# tmap::tm_shape(settler_density$area, id="area", name = "<b> [Settlers]</b> post-settlement area") +
# tmap::tm_fill("polygons", col = "indianred4", alpha = 0.6) +
# tmap::tm_borders(lwd = 0, col = "black") +
#
# # settlement grid
# tmap::tm_shape(settler_density$density, name = "<b> [Stats]</b> spatial grid") +
# tmap::tm_borders(lwd = 0.5, col = "black") +
#
# # settlement count
# tmap::tm_shape(settler_density$count, name = "<b> [Stats]</b> settlement count") +
# tmap::tm_fill("count", colorNA = "transparent", name = "Settlement density", palette = "plasma", alpha = 0.6) +
# tmap::tm_borders(lwd = 0, col = "black") +
#
# # settlement density
# tmap::tm_shape(settler_density$density, name = "<b> [Stats]</b> settlement density") +
# tmap::tm_fill("density", colorNA = "transparent", name = "Settlement density", palette = "magma", alpha = 0.6) +
# tmap::tm_borders(lwd = 0, col = "black") +
#
# # restoration plot
# tmap::tm_shape(restoration_plot, name = "<b> [Stats]</b> restoration hectare") +
# tmap::tm_borders(lwd = 2, col = "red")
tmp
## Warning: The shape <b> [Seascape]</b> habitats is invalid (after reprojection).
## See sf::st_is_valid
## Warning: The shape <b> [Seascape]</b> habitats contains empty units (after
## reprojection).
## Warning: The shape <b> [Seascape]</b> probability is invalid (after
## reprojection). See sf::st_is_valid
## Warning: The shape <b> [Seascape]</b> probability contains empty units (after
## reprojection).
## Warning: The shape <b> [Particles]</b> competency is invalid (after
## reprojection). See sf::st_is_valid
## Warning: The shape <b> [Particles]</b> competency contains empty units (after
## reprojection).